
function mapBreadCrumb(data: any[], path: string, indexArray: any[]) {
    let arr = Array.from(indexArray);
    for (let i = 0, len = data.length; i < len; i++) {
        arr.push({
            name: data[i].name,
            id: data[i].url,
        });
        if (data[i].url === path) {
            return arr;
        }
        let children = data[i].children;
        if (children && children.length) {
            let result: any = mapBreadCrumb(children, path, arr);
            if (result) {
                return result;
            }
        }
        arr.pop();
    }
}




function filterMenu(data: any[]) {
    const res = data.filter((item) => item.hideMenu !== true).filter((item) => item.type != 3)
    for (let item of res) {
        if (item.children && item.children.length) {
            item.children = filterMenu(item.children)
        }
    }
    return res
}


export { mapBreadCrumb, filterMenu }





